<?php

/**
*  @author tungck
*  @filesource home.php
*  
*/


class staff extends CI_Controller{
    
    function staff(){
        
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('adminlayout');
        $this->adminlayout->setLayout("admin/layout");
    }
    
    function test(){
        $title = "test layout";
        $data['data'] = "du lieu trang test";
        $this->adminlayout->view("admin/test", $data, $title);
    }
    
    function test1(){
        	$con = mysql_connect("localhost","root","");
	       mysql_select_db("sunnet", $con);

        $result = mysql_query("SELECT * FROM hosonhanvien;");
        var_dump($result);
		//Add all records to an array
		$rows = array();
		while($row = mysql_fetch_array($result))
		{
		    $rows[] = $row;
		}

		//Return result to jTable
		$jTableResult = array();
        
		$jTableResult['Result'] = "OK";
		$jTableResult['Records'] = $rows;
		print json_encode($jTableResult);

        
        //$this->adminlayout->view("admin/test", $data);
        
    }
    
    
    function listProfileStaff(){
        
        $title = "Gallery";
        $data['abc'] = null;
        $this->adminlayout->view("admin/list_staff",$data ,$title);
        
    }
    
    function getList(){
        
        $this->load->model("admin/staff_managers_model");
        $rows = array();
        $query = $this->staff_managers_model->getList();
        var_dump($query);
        while($row = mysql_fetch_array($query))
		{
		    $rows[] = $row;
		}
        $jTableResult = array();
		$jTableResult['Result'] = "OK";
		$jTableResult['Records'] = $rows;
		print json_encode($jTableResult);
    }
}

?>